from django.shortcuts import render, HttpResponse, reverse
from app01 import models

def article(request,*args,**kwargs):
	# print(request.path_info)
	# url = reverse('article', kwargs=kwargs)
	condition = {}
	for k,v in kwargs.items():
		kwargs[k] = int(v)
		if v == '0':
			pass
		else:
			condition[k] = v
	result = models.Article.objects.filter(**condition)
	cate_list = models.Category.objects.all()
	# type_list = models.ArticleType.objects.all()
	type_list = models.Article.type_choice
	print(type_list)
	return render(request,'article.html', {'result':result,
										   'cate_list':cate_list,
										   'type_list':type_list,
										   'url_info':kwargs})